package ${entity.namespace}.${prefixPackage};

import java.util.LinkedList;
import java.util.List;
import ${entity.namespace}.entity.${entity.nameCapital};
import com.fzy.core.BaseService;

public class ${entity.nameCapital}Service extends BaseService {

	${entity.nameCapital}ListMapper ${entity.nameUncapital}ListMapper;

	public List list(${entity.nameCapital}ListQuery ${entity.nameUncapital}Query) {
		String sql = "select * from ${entity.table} where 1=1";
		List params = new LinkedList();
<#list entity.queryProperties as property><#t/>
	<#if statics["com.fzy.core.codetools.PropertyWrapper"].STRING == property.propertyType><#t/>
		sql += getConditionSql(${entity.nameUncapital}Query.get${property.nameCapital}(), "${property.columnName} like", params, true);
	<#elseif statics["com.fzy.core.codetools.PropertyWrapper"].DATE == property.propertyType><#t/>
		sql += getConditionSql(${entity.nameUncapital}Query.get${property.nameCapital}(), "${property.columnName} =", params);
	<#elseif statics["com.fzy.core.codetools.PropertyWrapper"].NUMBER == property.propertyType><#t/>
		sql += getConditionSql(${entity.nameUncapital}Query.get${property.nameCapital}(), "${property.columnName} =", params);
	<#else><#t/>
		sql += getConditionSql(${entity.nameUncapital}Query.get${property.nameCapital}(), "${property.columnName} =", params);
	</#if><#t/>
</#list><#t/>
		List l = query(sql, params.toArray(), ${entity.nameUncapital}ListMapper);
		return l;
	}

	public ${entity.nameCapital} get(Long id) {
		return (${entity.nameCapital}) getSession().get(${entity.nameCapital}.class, id);
	}

	public void set${entity.nameCapital}ListMapper(${entity.nameCapital}ListMapper ${entity.nameUncapital}ListMapper) {
		this.${entity.nameUncapital}ListMapper = ${entity.nameUncapital}ListMapper;
	}

}
